//
// Created by zhangJA on 2020/6/26.
//分段函数：求当r*r<=s*s时,k=sqrt(sin(r)*sin(r)+sin(s)*sin(s));当r*r>s*s时,sin(r*s)/2。
//sin x=x/1!-x^3/3!+x^5/5!-x^7/7+....=E(求和符号)(-1)^(n-1) * x^(2n-1)/(2n-1)!
//计算精度：10^(-10)


#include <iostream>
#include <cmath>
using namespace std;

const double TINY_VALUE=1e-10;//计算精度为10^(-10)
//自制函数sin(x)
double tsin(double x)
{
    double g=0;
    double t=x;
    int n=1;
    do {
        g+=t;
        n++;
        t=-t*x*x/(2*n-1)/(2*n-2);
    }while (fabs(t)>=TINY_VALUE);
    return g;
}
//主函数
int main()
{
    double k,r,s;
    cout<<"r=";
    cin>>r;
    cout<<"s=";
    cin>>s;
    if (r*r<=s*s)
        k=sqrt(tsin(r)*tsin(r)+tsin(s)*tsin(s));
    else
        k=tsin(r*s)/2;
    cout<<k<<endl;
    return 0;
}


